// 提交按钮防抖，传入的毫秒数内，以最后一次请求为准发送
function debounce(fn, t) {
    let delay = t || 500
    let timer
    return function() {
        let args = arguments
        if (timer) {
            clearTimeout(timer)
        }

        let callNow = !timer

        timer = setTimeout(() => {
            timer = null
        }, delay)

        if (callNow) fn.apply(this, args)
    }
}
export {
    debounce
}